<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>伪元素使用场景之土豆网遮罩层案例</title>
    <style>
        /* 简化html 的结构。像遮罩层肯定会有很多不可能都在结构里写上 所有用伪元素合适，不占html结构 */
        .tudou {
            position: relative;
            width: 444px;
            height: 320px;
            background-color: pink;
            margin: 100px auto;
        }

        img {
            width: 100%;
            height: 100%;
        }

        .tudou::before {
            /* 使用伪类选择器必须要有content属性 */
            content: "";
            display: none;
            position: absolute;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, .4) url(../第九天.css定位属性/images/arr.png) no-repeat center;
        }
        .tudou:hover::before {
            display: block;
        }
    </style>

</head>

<body>
    <div class="tudou">
        <img src="../第九天.css定位属性/images/tudou.jpg" alt="">
    </div>
    <div class="tudou">
        <img src="../第九天.css定位属性/images/tudou.jpg" alt="">
    </div>   <div class="tudou">
        <img src="../第九天.css定位属性/images/tudou.jpg" alt="">
    </div>   <div class="tudou">
        <img src="../第九天.css定位属性/images/tudou.jpg" alt="">
    </div>   <div class="tudou">
        <img src="../第九天.css定位属性/images/tudou.jpg" alt="">
    </div>
</body>

</html>